/**
 * Created by YJH on 2018/5/24.
 */
import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    TouchableOpacity,
    Image,
} from 'react-native';

import HomePage from './home/HomePage'
import ThemeDao from '../expand/dao/ThemeDao';
export default class WelcomePage extends Component {

    constructor(props) {
        super(props);
        this.themeDao=new ThemeDao();
    }

    componentDidMount() {
        this.themeDao.getTheme().then(result=>{
            this.theme=result;
        });
        setTimeout(() => {
            //不使用navigete 目的：重置路由
            this.timer = this.props.navigator.resetTo({
                component: HomePage,
                params:{
                    theme:this.theme
                },
            })
        }, 200)
    }

    componentWillUnmount() {
        this.timer && clearTimeout(this.timer)
    }

    render() {
        return (
            <View style={styles.container}>
                <Text style={styles.welcome_js}>WelcomePage.js</Text>
                <Text style={styles.welcome_word}>欢迎来到王者荣耀</Text>
            </View>
        )
    }
}

const styles = StyleSheet.create(
    {
        container: {
            flex: 1,
        },

        welcome_js: {
            marginTop: 80,
            fontSize: 30,
            color: 'black',
            alignSelf: 'center',
        },
        welcome_word: {
            marginTop: 20,
            fontSize: 30,
            color: '#2196F3',
            alignSelf: 'center',
        }
    }
)